<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListBillTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form>
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h:outputText escape="false" value="#{bundle.ListBillEmpty}" rendered="#{exporterController.exportersBill.rowCount == 0}"/>
                <h:panelGroup rendered="#{exporterController.exportersBill.rowCount > 0}">
                    <h:outputText value="#{exporterController.pagination.pageFirstItem + 1}..#{billController.pagination.pageLastItem + 1}/#{billController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{exporterController.previous}" value="#{bundle.Previous} #{exporterController.pagination.pageSize}" rendered="#{billController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{exporterController.next}" value="#{bundle.Next} #{exporterController.pagination.pageSize}" rendered="#{billController.pagination.hasNextPage}"/>&nbsp;
                    <p:dataTable value="#{exporterController.exportersBill}" var="item" paginator="true" rows="10"  
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="5,10,15">

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBillTitle_createDate}"/>
                            </f:facet>
                            <h:outputText value="#{item.createDate}">
                                <f:convertDateTime pattern="dd/MM/yyyy" />
                            </h:outputText>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBillTitle_billNumber}"/>
                            </f:facet>
                            <h:outputText value="#{item.billNumber}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="الدفتر"/>
                            </f:facet>
                            <h:outputText value="#{item.docNum}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBillTitle_billTotal}"/>
                            </f:facet>
                            <h:outputText value="#{item.billTotal}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBillTitle_billReminder}"/>
                            </f:facet>
                            <h:outputText value="#{item.billReminder}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBillTitle_billCach}"/>
                            </f:facet>
                            <h:outputText value="#{item.billCach}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBillTitle_exporterID}"/>
                            </f:facet>
                            <h:outputText value="#{item.exporterID.exporterName}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{exporterController.viewExporterBill(item)}" value="#{bundle.ListExporterViewLink}" styleClass="btn btn-primary"/>
                        </p:column>

                    </p:dataTable>
                </h:panelGroup>

            </h:form>
        </ui:define>
    </ui:composition>

</html>
